<template>
	<view class="home_wrap">
		<view class="modules_box">
			<view class="module_item" :style="`background-color:${ml.bgColor};`" v-for="(ml, indexM) in homeStore.moduleList" :key="indexM" @click="moduleClick(ml)">
				<IconImg :icon-tag="ml.iconTag"></IconImg>
				<text class="text">{{ ml.moduleName }}</text>
			</view>
		</view>
	</view>
</template>

<script>
import { defineComponent, onMounted, ref } from 'vue'
import './index.scss'
export default defineComponent({
	name: 'Index'
})
</script>
<script setup>
import IconImg from './components/iconImg.vue'
import { useHomeStore } from '@/stores/home.js'

const homeStore = useHomeStore()

// 模块点击事件
const moduleClick = (item) => {
	console.log('当前点击的模块：', item)
	uni.navigateTo({
		url:item.toPath
	})
}

onMounted(() => {
	console.log('当前模块列表：', homeStore.moduleList)
})
</script>

<style lang="scss" scoped></style>
